package kiki.app;

import com.kikidao.app.exceptions.DAOCheckedExeption;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws DAOCheckedExeption {

        Person person1 = new Person(1);

        System.out.println("--------------------");
        PersonDAO personDAO = new PersonDAOImpl();
        personDAO.create(new Person("Hifi"));

        System.out.println("--------------------");
        Person person = personDAO.read(person1);
        System.out.println("Read person: "+person);

        System.out.println("--------------------");
        personDAO.update(new Person(1,"Mifi"));
        System.out.println("Updated person: "+personDAO.read(person1));

        System.out.println("--------------------");
        personDAO.delete(person1);
        try{
            personDAO.read(person1);
        }catch (DAOCheckedExeption e){
            System.out.println("Person deleted successfully.");
        }

        System.out.println("--------------------");
        personDAO.create(new Person("Fifi"));
        System.out.println("Elements in table PERSON: "+personDAO.list());



    }




}
